Skip to main content

Math library functions that return NaN

Generally, Math functions that are given non-numeric arguments will return NaN.

Math.floor("a")

The square root of a negative number returns NaN, because Math.sqrt does not support imaginary or complex numbers.

Math.sqrt(-1)